class EnvatoMarketCard extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { this.item = this.hasAttribute('item') ? this.getAttribute('item') : null; this.render(); } disconnectedCallback() {} render() { const { shadowRoot, item } = this; console.log(JSON.stringify(item, null, 2)); shadowRoot.innerHTML = `

Hello world

This is content in the body of our card

${item ? `

You want to render item ID: ${item}

` : "

You didn't specify an item ID…

"}
`; } } customElements.define('envato-market-card', EnvatoMarketCard);